<template>
  <!-- 项目实施 - 12相关方管理 - tab2完结项目 -->
  <div class="stakeholder-management-end">
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form class="search" :inline="true" :model="formData" label-position="right" label-width="90px">
          <el-row :gutter="12">
            <el-col :span="16" v-if="showSearch == false">
              <advancedFilter></advancedFilter>
            </el-col>
            <el-col :span="6" v-if="showSearch">
              <el-form-item label="项目名称">
                <el-input v-model="formData.ipt1" clearable placeholder="搜索关键字" style="width: 100%;"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="showSearch">
              <el-form-item label="相关方名称">
                <el-input v-model="formData.ipt2" clearable placeholder="搜索关键字" style="width: 100%;"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="showSearch ? 12 : 8" style="text-align: right;">
              <el-button type="primary">筛选</el-button>
              <el-button @click="resetForm">重置</el-button>
              <el-button type="text" @click="changeSearch"> {{showSearch===true ? '高级筛选' : '普通筛选'}} </el-button>
            </el-col>
          </el-row>
        </el-form>
      </el-col>
      <el-col :span="24">
        <cust-act-table
          ref="custActTable"
          tableType=""
          :list="tableData"
          :colConfigs="customColumns"
          @changePage="changePage"
          @getSelectedRow="modalState = true"
          :pageNum="page.pageNum"
          :pageSize="page.pageSize"
          :total="page.total"
          showIdx
          :showAct="false"
          rKey="index"
        ></cust-act-table>
      </el-col>
    </el-row>
    <el-dialog title="查看" :visible.sync="modalState" @close="modalState = false" width="800px" :close-on-click-modal="false">
      <modalBtns :modalType="modalType" @close="modalState = false"></modalBtns>
      <formName text="相关方登记册"></formName>
      <div class="form-content">
        <formPart listTitle="项目信息" ref="info1" :modalTitle="modalType == 'add' || modalType == 'edit' ? 'EDIT-FORM' : '查看'" :formList="formInfo.info1"></formPart>
        <formPart listTitle="相关方信息" ref="info2" :modalTitle="modalType == 'add' || modalType == 'edit' ? 'EDIT-FORM' : '查看'" :formList="formInfo.info2"></formPart>
        <formPart v-if="modalType != 'add'" listTitle="跟进信息" ref="info3" :modalTitle="modalType == 'edit' ? 'EDIT-FORM' : '查看'" :formList="formInfo.info3"></formPart>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { tableData12_2, customColumns12_2 } from '../../js/staticData';
import advancedFilter from '../../components/advancedFilter';
import modalBtns from '../../components/modalBtns';
import formName from '../../components/formName';
import formPart from '../../components/formPart';
import custActTable from "../../components/custActTable.vue";
export default {
  name: "stakeholderManagementEnd",
  components: {custActTable, advancedFilter, modalBtns, formName, formPart },
  data() {
    return {
      formData: {
        ipt1: '',
        ipt2: ''
      },
      showSearch: true,
      customColumns: customColumns12_2,
      tableData: tableData12_2,
      page: {
        pageNum: 1, // 当前页
        pageSize: 10, // 每页条数
        total: 0, // 总条数
      },
      modalState: false,
      modalType: '',
      modalTitle: '',
      formInfo: {
        info1: [
          { l: '项目名称', v: '蓝旗机器人造林系统升级', type: 'input', span: 12 },
          { l: '项目编号', v: 'GC2022010001', type: 'input', span: 6 },
          { l: '项目负责人', v: '朱冠', type: 'input', span: 6 }
        ],
        info2: [
          { l: '名称', v: '王伟', type: 'input', span: 6 },
          { l: '分类', v: '外部', type: 'input', span: 6 },
          { l: '项目角色', v: '主管领导', type: 'input', span: 6 },
          { l: '管理中', v: '是', type: 'input', span: 6 },
          { l: '企业名称', v: 'XX集团有限公司', type: 'input', span: 12 },
          { l: '部门', v: '总经办', type: 'input', span: 6 },
          { l: '职务', v: '总经理助理', type: 'input', span: 6 },
          { l: '联系电话', v: '18866668888', type: 'input', span: 6 },
          { l: '权利影响', v: '8级', type: 'input', span: 6 },
          { l: '关心程度', v: '较关心', type: 'input', span: 6 },
          { l: '管理策略', v: '重点管理', type: 'input', span: 6 },
          { l: '评估参与度', v: '支持', type: 'input', span: 6 },
          { l: '当前参与度', v: '支持', type: 'input', span: 6 },
          { l: '登记日期', v: '2024-08-02', type: 'input', span: 6 },
          { l: '登记人', v: '朱冠', type: 'input', span: 6 },
          { l: '期望', v: '', type: 'input', span: 24 }
        ],
        info3: [
          { l: '跟进人', v: '苑珙', type: 'input', span: 6 },
          { l: '跟进日期', v: '', type: 'input', span: 6 },
          { l: '跟进说明', v: '', type: 'input', span: 12 }
        ]
      }
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.tableData = tableData12_2;
      this.customColumns = customColumns12_2;
    })
  },
  watch: {
    modalPic(n) {}
  },
  methods: {
    /**
     * @author Wrl
     * 重置查询条件
     */
    resetForm() {
      this.formData = {};
    },
    /**
     * @author Wrl
     * 切换查询条件
     */
    changeSearch() {
      this.showSearch = !this.showSearch
    },
		/**
		 * @author Wrl
		 * 获取分页信息
		 */
		changePage(page) {
			this.page.pageNum = page.pageNum; // 当前页
			this.page.pageSize = page.pageSize; // 每页条数
			this.page.total = page.total; // 总数
		},
  }
};
</script>

<style lang="scss" scoped>
  .stakeholder-management-end {
    ::v-deep {
      .search {
        .el-form-item {
          width: 100%;
        }
        .el-form-item__content {
          width: calc(100% - 90px);
        }
      }
      .el-dialog__body {
        padding: 0px 20px 30px;
      }
      .el-card__body {
        padding: 10px 20px 0;
      }
    }
    .tree-search {
      width: 200px;
      ::v-deep .el-input__inner {
        border-radius: 20px;
      }
    }
    .cust-tree {
      margin-top: 16px;
    }
    .border-r {
      min-width: 220px;
      border-right: 1px solid #cccccc;
    }
  }
</style>